﻿using System;
using System.Collections.Generic;
using System.Windows.Data;
using TimetableSystem.Model;
using System.Windows;

namespace TimetableSystem
{
    /// <summary>
    /// Converts a list of Coursework objects to a visibility (null or empty list returns a collapsed Visibility)
    /// </summary>
    public class CourseworkVisibilityConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            var coursework = (List<Coursework>)value;
            if (coursework == null || coursework.Count == 0)
                return Visibility.Collapsed;
            else
                return Visibility.Visible;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
